Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Launching the standalone Megatron teacher server (
python -m slime.backends.megatron_utils.server.megatron_server)with default arguments always crashes during startup. It fails before loading model weights or opening its HTTP port:
This PR adds
SampleManager.register_training_actorssoRayTrainGroupcan register actors when the teacher serverstarts. It also adds a CPU unit test in CI so future changes do not break this path again.
Root Cause
slime/ray/actor_group.py, whenever a rollout manager is provided,RayTrainGroup._allocate_gpus_for_actor()calls
self._rollout_manager.register_training_actors.remote(self.role, self._actor_handlers, self.args). It thenreads
update_weight_start_versionfrom the returned dictionary.slime/backends/megatron_utils/server/megatron_server.py,launch()passes itsSampleManageractor as therollout manager to
create_training_models(). However,SampleManagernever implementedregister_training_actors.register_training_actorscall toRayTrainGroup. However,megatron_server.pywas not updated, and CI only tested argument parsing(
tests/utils/test_megatron_server_arguments.py). As a result, the standalone teacher server has crashed on everylaunch since PR Support manual Megatron restarts with retained serving #2444 (including
v0.4.0).Fix
slime/backends/megatron_utils/server/megatron_server.py: AddSampleManager.register_training_actors(self, role, actors, configuration)returning{"update_weight_start_version": getattr(self.args, "update_weight_start_version", 0)}.update_weight_start_version(or0by default) matches whatRolloutManager.register_training_actorsreturnswhen neither is active.
Tests and CI
tests/utils/test_megatron_server_startup.py(NUM_GPUS = 0, 5 CPU test cases, with anif __name__ == "__main__":entrypoint for running directly in CI withpython).SampleManager.register_training_actorsdefaultsupdate_weight_start_versionto0when unset, andkeeps the configured value when set.
RayTrainGroup.create(rollout_manager=...)with a realSampleManagerinstance, using a small wrapper thatexposes
.remote(...)calls and mocked Ray workers so no GPU or Ray cluster is needed. It checks that registrationsucceeds and passes
update_weight_start_versionto worker initialization andRayTrainGroup._disk_weight_version.{'test_file': 'utils/test_megatron_server_startup.py', 'num_gpus': 0}undercpu-unittestin.github/workflows/pr-test.yml.j2, and regenerated.github/workflows/pr-test.ymlwithpython .github/workflows/generate_github_workflows.py. Both this new file andtests/utils/test_megatron_server_arguments.pyare CPU-only (NUM_GPUS = 0).startup registration between
RayTrainGroupandSampleManager. Without this fix, all 5 test cases fail withAttributeError. As a result, CI will now catch future changes inRayTrainGroupthat breakSampleManager.Verification
Local Checks
Run from the repository root:
GPU Verification
Verified on 1 GPU with
Qwen2.5-0.5B-Instructusing the default launch arguments for the teacher server:AttributeError: 'ActorHandle' object has no attribute 'register_training_actors'atslime/ray/actor_group.py:139and never opened its HTTP port.
/generateacross 3 consecutive GPU runs.